/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.shelf.service;

import com.thinkgem.jeesite.common.service.TreeService;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.shelf.dao.BkShelfDao;
import com.thinkgem.jeesite.modules.shelf.entity.BkShelf;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 书架管理Service
 * @author ZC
 * @version 2017-05-15
 */
@Service
@Transactional(readOnly = true)
public class BkShelfService extends TreeService<BkShelfDao, BkShelf> {

	public BkShelf get(String id) {
		return super.get(id);
	}
	
	public List<BkShelf> findList(BkShelf bkShelf) {
		if (StringUtils.isNotBlank(bkShelf.getParentIds())){
			bkShelf.setParentIds(","+ bkShelf.getParentIds()+",");
		}
		return super.findList(bkShelf);
	}
	
	@Transactional(readOnly = false)
	public void save(BkShelf bkShelf) {
		super.save(bkShelf);
	}
	
	@Transactional(readOnly = false)
	public int delete(BkShelf bkShelf) {
		return super.delete(bkShelf);
	}
}